aux_source_directory(. APP_SOURCES)

# list(APPEND APP_SOURCES
# ${CMAKE_SOURCE_DIR}/include/janna/libs/extensionsystem/iplugin.h
# )
qt_add_executable(${PROJECT_NAME}
    MANUAL_FINALIZATION
    ${APP_SOURCES}
    ${QRC_FILES}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    ${janna_libs_utils_lib_name}
    ${janna_libs_extensionsystem_lib_name}

    # ${core_plugin_name}
    fmt::fmt
    spdlog::spdlog
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    Qt${QT_VERSION_MAJOR}::Widgets
)

set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${bin_dir})

# 添加插件依赖
add_dependencies(${PROJECT_NAME}
    ${core_plugin_name}
)
qt_finalize_executable(${PROJECT_NAME})

# 构建后动作
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD

    # 复制资源文件
    COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/resources/plugins/plugins.json ${plugin_dir}/plugins.json
    COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/resources/plugins/plugin_desc.schema.json ${res_dir}/plugins/plugin_desc.schema.json
    COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/resources/plugins/plugins.schema.json ${res_dir}/plugins/plugins.schema.json
)
